package main

import (
	"os"

	"gitee.com/zh-jn/harmonica-previewer-online/api"
	"gitee.com/zh-jn/harmonica-previewer-online/storage/localstorage/service"
)

func CollectConfigFromEnv() service.Config {
	return service.Config{
		Addr:    api.ParseString(os.Getenv("LocalStorageService_Addr"), "0.0.0.0"),
		Port:    api.ParseIntValue(os.Getenv("LocalStorageService_Port"), 8080),
		BaseDir: api.ParseString(os.Getenv("LocalStorageService_BaseDir"), "/data/localstorage"),
	}
}

func main() {
	cfg := CollectConfigFromEnv()
	service.RunServer(cfg)
}
